<?php
namespace app\admin\controller;

use app\admin\logic\AdminCategoryLogic;
use app\admin\logic\UserLogic;
use app\admin\controller\Base;
use think\cache\driver\Redis;
use think\exception\ErrorException;
use think\facade\View;
class Index extends Base
{
    public function index(){
        try{
            $data = array();
            $user = new UserLogic();
            $user = $user->adminLogin($data);
            $admin_category = new AdminCategoryLogic();
            $admin_category = $admin_category->CategoryLeftList();
            View::assign([
                'name'  => $user,
                'category' => $admin_category,
            ]);
        }catch (ErrorException $e){

        }
        return view('index');
    }
    public function getCategory(){
        $admin_category = new AdminCategoryLogic();
        $admin_category = $admin_category->CategoryList();
        $ret = ['code'=> 0,'data'=>$admin_category];
        return $ret;
    }
}
